﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Baik;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Baik.Interface.Execution;
using Baik.Interface.Expression;
using IUndefined = Baik.Interface.Execution.IUndefined;

namespace Tester
{
    [TestClass]
    public class InhertenceTest
    {
        public BaikInstance Instance = new BaikInstance();

        //Multiple Inhertence Behaviour
        [TestMethod]
        public void given_object_inherit_parent_when_access_variable_check_parent()
        {
            var rtn = Instance.Evaluate("{b:(){return this.a;};}.inherit({a:true;}).b();");
            Assert.IsTrue(rtn is Baik.Interface.Execution.ITrue);
        }

        //can not see sibling inheritence
        [TestMethod]
        public void Given_variable_is_decalred_in_uncle_when_access_variable_then_return_undefined()
        {
            var rtnobj = Instance.Evaluate("{c:{val:true; b:{}.inherit(c);};a:{};}");
            var rtnval = Instance.Evaluate("a.val");
            Assert.IsTrue(rtnval is IUndefined);
        }
    }
}
